ARG BASE_OS=registry.openanolis.cn/openanolis/anolisos:23

FROM ${BASE_OS}

ARG NODE_VERSION=18.17.1 \
    OS_SUFFIX=23
ENV NODE_VERSION ${NODE_VERSION}

LABEL org.opencontainers.image.title="Node.js" \
      org.opencontainers.image.version="${NODE_VERSION}-${OS_SUFFIX}"

RUN set -eux; \
    dnf update -y; \
    dnf provides nodejs | grep "${NODE_VERSION}" | awk 'NR==1{print $1}' | xargs dnf install -y yarnpkg; \
    dnf clean all; \
    groupadd -g 1000 node; \
    adduser -u 1000 -g node -s /bin/sh node

USER node
